<?php /*a:1:{s:78:"C:\Users\pc306\PhpstormProjects\phpzhengshiban\app\index\view\index.index.html";i:1592481952;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Demo</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
    <meta content="Demo" name="keywords"/>
    <meta content="Demo" name="description"/>
    <script type="text/javascript" src="/plug/layui/layui.js"></script>
    <script type="text/javascript" src="/static/script/common.js"></script>
    <link rel="stylesheet" type="text/css" href="/static/css/simple.css" />
    <link rel="stylesheet" type="text/css" href="/plug/awesome/css/font-awesome.css" />
    <style type="text/css">
        iframe {
            position: absolute;
            width: 100%;
            height: 100%;
            left: 0;
            top: 0;
            right: 0;
            bottom: 0;
        }
    </style>
</head>
<body>
<div class="admin-menu fold">
    <ul>
        <li class="menu-item" data-param="1">
            <a href="javascript:void(0)"><i class="fa fa-android fa-fw"></i></a>
        </li>
    </ul>
</div>
<div class="admin-submenu">
    <div style="width: 100%; height: 100%">
        <ul data-param="1" style="display: none">
            <li data-param="100" data-url="/index/contacts/index/">
                <a href="javascript:void(0)"><i class="fa fa-user-circle fa-fw"></i> 通讯录</a>
            </li>
        </ul>
    </div>
</div>
<div class="admin-content">
    <iframe class="myadmin-iframe" frameborder="0" id="workspace"></iframe>
</div>
<script type="text/javascript">
    layui.use(["layer", "form", "table", "upload", "element", "laydate"], function () {
        let menu = layui.jquery(".admin-menu");
        let submenu = layui.jquery(".admin-submenu");
        let workspace = layui.jquery("#workspace");
        //记录菜单
        let one = isEmpty(getCookie("one")) ? "1" : getCookie("one");
        let two = isEmpty(getCookie("two")) ? "100" : getCookie("two");
        let url = isEmpty(getCookie("url")) ? "/index/contacts/index/" : getCookie("url");
        menu.find("li").removeClass("active");
        submenu.find("li").removeClass("active");
        submenu.find("ul").css("display", "none");
        workspace.attr("src", url);
        menu.find("li").each(function () {
            if (layui.jquery(this).attr("data-param") === one) {
                layui.jquery(this).addClass("active");
                submenu.find("ul[data-param=" + "\"" + layui.jquery(this).attr("data-param") + "\"" + "]").css("display", "block");
            }
        });
        submenu.find("li").each(function () {
            if (layui.jquery(this).attr("data-param") === two) {
                layui.jquery(this).addClass("active");
            }
        });
        //一级菜单
        menu.find("li").click(function () {
            menu.find("li").removeClass("active");
            submenu.find("ul").css("display", "none");
            layui.jquery("li[data-param=" + layui.jquery(this).attr("data-param") + "]").addClass("active");
            submenu.find("ul[data-param=" + "\"" + layui.jquery(this).attr("data-param") + "\"" + "]").css("display", "block");
        });
        //二级菜单
        submenu.find("li").click(function () {
            let url = layui.jquery(this).attr("data-url");
            let data = layui.jquery(this).attr("data-param");
            setCookie("one", data.substring(0, 1));
            submenu.find("li").removeClass("active");
            layui.jquery(this).addClass("active");
            workspace.attr("src", url);
            setCookie("two", data);
            setCookie("url", url);
        });
    });
</script>
</body>
</html>
